<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tk="http://www.qdocuments.net" exclude-result-prefixes="tk">
  <xsl:template name="tk:FormAttr">
    <xsl:choose>
      <xsl:when test="$tk:IsHttpPost=1">
        <xsl:attribute name="method">post</xsl:attribute>
        <xsl:attribute name="enctype">multipart/form-data</xsl:attribute>
        <xsl:attribute name="action"><xsl:value-of select="$tk:DSelfURL"/></xsl:attribute>
        <input type="hidden" name="hdSaveType"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:attribute name="onsubmit">return false;</xsl:attribute>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <xsl:template name="tk:FormPost">
    <script>
      <xsl:comment><![CDATA[
			function Post(save)
			{
				if (CheckUpload())
				{
					frmData.hdSaveType.value = save;
					frmData.submit();
				}
			}
			]]></xsl:comment>
    </script>
  </xsl:template>
  <xsl:template name="tk:XmlHttpPost">
    <script>
			var source = "<xsl:value-of select="$tk:Source"/>";
			var url = "<xsl:value-of select="$tk:DSelfURL"/>";
			<xsl:comment><![CDATA[
			function Post(save)
			{
				if (CheckUpload())
				  PostFunc(url, source, save);
			}
			]]></xsl:comment>
    </script>
  </xsl:template>
  <xsl:template name="tk:DefaultPost">
    <xsl:choose>
      <xsl:when test="$tk:IsHttpPost=1">
        <xsl:call-template name="tk:FormPost"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="tk:XmlHttpPost"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
